package com.inspur.gs.sbssdl.sbwhgl.sbrh.sbrh.back.bizactions;
import com.inspur.edp.bef.api.lcp.IStandardLcp;
import com.inspur.edp.bef.core.LcpUtil;

import com.inspur.edp.bef.engine.entity.AssociationInfo;
import com.inspur.edp.cef.entity.changeset.*;
import com.inspur.edp.bef.api.be.*;
import com.inspur.edp.bef.spi.action.AbstractManagerAction;
import io.iec.edp.caf.commons.utils.SpringBeanUtils;
import io.iec.edp.caf.sysmanager.api.data.user.User;
import io.iec.edp.caf.sysmanager.api.manager.user.UserManager;


public class sbssSbrhRwzxrUprMgrAction extends AbstractManagerAction<String> {
	private String taskId;
	private String zxrId;
	public sbssSbrhRwzxrUprMgrAction(IBEManagerContext managerContext, String taskId, String zxrId) {
		super(managerContext);
		this.taskId = taskId;
		this.zxrId = zxrId;
	}
	private String rhCfg = "com.inspur.gs.sbssdl.sbwhgl.sbrh.sbrh.back.sbssSbrhRw";


	@Override
	public  void execute() {
		IStandardLcp lcp = LcpUtil.getLcp(rhCfg);

		ModifyChangeDetail mcd = new ModifyChangeDetail(taskId);
		UserManager userManager = SpringBeanUtils.getBean(UserManager.class);
		User user = userManager.getUser(zxrId);

		if (user == null){
			return;
		}
		AssociationInfo zxrInfo = new AssociationInfo();
		zxrInfo.setValue("zxrId",zxrId);
		mcd.setItem("zxrId",zxrInfo);

		mcd.setItem("zxrName",user.getName());
		mcd.setItem("zxrCode",user.getCode());

		lcp.modify(mcd);
		lcp.save();

	}
	private IBusinessEntity getEntity(String dataId) {
		return (IBusinessEntity)super.getBEManagerContext().getEntity(dataId);
	}	private IBEService getMgr() {
		return (IBEService)super.getBEManagerContext().getBEManager();
	}
}